<template>
  <div class="inews">
    <div class="news_t">
      <span class="fr"
        ><a href="javascript:;" @click.prevent="skipToNewsCenter"
          >更多 ></a
        ></span
      >新闻资讯
    </div>
    <ul>
        <li v-for='news in hotNewsList' :key='news.id'><span>[ {{news.title.lastIndexOf("特惠") == -1 ? "公告" : "特惠"}} ]</span><router-link :to='{name:"NewsDetail", params:{title: news.title, content: news.content}}'>{{news.title}}</router-link></li>
      <!-- <li><span>[ 特惠 ]</span><a href="#">掬一轮明月 表无尽惦念</a></li>
      <li><span>[ 公告 ]</span><a href="#">好奇金装成长裤新品上市</a></li>
      <li><span>[ 特惠 ]</span><a href="#">大牌闪购 · 抢！</a></li>
      <li><span>[ 公告 ]</span><a href="#">发福利 买车就抢千元油卡</a></li>
      <li><span>[ 公告 ]</span><a href="#">家电低至五折</a></li> -->
    </ul>
    <div class="charge_t">
      话费充值
      <div class="ch_t_icon"></div>
    </div>
    <form>
      <table
        border="0"
        style="width: 205px; margin-top: 10px"
        cellspacing="0"
        cellpadding="0"
      >
        <tr height="35">
          <td width="33">号码</td>
          <td><input type="text" value="" class="c_ipt" /></td>
        </tr>
        <tr height="35">
          <td>面值</td>
          <td>
            <select class="jj" name="city">
              <option value="0" selected="selected">100元</option>
              <option value="1">50元</option>
              <option value="2">30元</option>
              <option value="3">20元</option>
              <option value="4">10元</option>
            </select>
            <span style="color: #ff4e00; font-size: 14px">￥99.5</span>
          </td>
        </tr>
        <tr height="35">
          <td colspan="2">
            <input type="submit" value="立即充值" class="c_btn" />
          </td>
        </tr>
      </table>
    </form>
  </div>
</template>

<script>
import Vue from 'vue'
export default {
  data() {
    return {
        hotNewsList: []
    };
  },
  methods: {
    skipToNewsCenter() {
      this.$router.push({
        name: "NewsList",
      });
    },
  },
  beforeMount() {
    Vue.prototype //展示5条最热门资讯
      .$axios({
        url: "/api/news/pageinfo",
        method: "POST",
        data: {
          pageNum: 1,
          pageSize: 5,
        },
      })
      .then((rs) => {
        this.hotNewsList = rs.data.pageinfo.list;
      });
  },
};
</script>

<style>
</style>